<?php
namespace App\Repository\Java;

use App\Repository\Contracts\FeedbackInterface;
use App\Repository\Contracts\FeedbackJavaInterface;
use Illuminate\Support\Facades\DB;

/**
 * @Author:: HuangYin
 * @DateTime: 2017-02-06 13:38
 *
 * @Description:
 */
class FeedbackRepository extends Repository implements FeedbackJavaInterface
{
    protected function setPrefix()
    {
        $this->prefix = '';
    }

    public function syncCreated($storeId, array $data)
    {
        $data['storeId'] = $storeId;

        return $this->post(__FUNCTION__, $data);
    }

    public function syncList($storeId, $maxId = 0)
    {
        $data['storeId'] = $storeId;
        $data['maxId'] = $maxId;
        $result = $this->post(__FUNCTION__, $data);

        return $result['resultType'] === 'success' && DB::table('feedback')->insert($result['resultData']);
    }
}